<!--
 * @描述: 
 * @作者: 约訂
 * @Date: 2024-07-31 15:09:37
 * @LastEditTime: 2024-08-07 13:56:40
 * @修改人员: 约訂
-->
<template>
  <div>
    <vxe-modal
      v-model="openAddress"
      width="850"
      @close="HideAddress"
      :mask="true"
      :lockView="true"
      :height="isMultiple ? 700 : 620"
      class="employees_box"
    >
      <template #title>
        <div class="flex-box l-c-s">
          <slot name="title"> 省/市/区(县)/街道选择 </slot>
          <div class="tab_title">
            {{ addressJson.spellingText }}
          </div>
        </div>
      </template>
      <template #default>
        <!-- type="border-card" -->
        <div class="flex-box l-s-s max_box">
          <div class="more_box flex-box c-s-s" v-if="isMultiple">
            <div class="address_list">
              <div
                class="flex-box l-s-s"
                v-for="(item, index) in brushList"
                :key="'show_address_' + index"
              >
                {{ item.showText }}
              </div>
            </div>
          </div>
          <div class="pad_left" v-else></div>
          <div class="add_search">
            <el-cascader
              placeholder="搜索地址"
              :options="addressAllData"
              filterable
              clearable
              :props="props"
              @change="ChangeSearchAddress"
            ></el-cascader>
          </div>
          <el-tabs v-model="addressTab" class="address_tab">
            <el-tab-pane label="省/市" name="province">
              <div>
                <div
                  class="flex-box l-s-s letter_list"
                  v-for="(item, index) in provinceList"
                  :key="'province_' + index"
                >
                  <div class="range flex-box l-c-s">
                    {{ item.value }}
                  </div>
                  <div class="flex-box l-s-s name_list">
                    <div
                      class="item flex-box l-c-s"
                      v-for="(name, i) in item.list"
                      :key="'province_name_' + i"
                    >
                      <el-checkbox
                        v-if="isMultiple"
                        :indeterminate="name.unknown"
                        v-model="name.value"
                        @change="
                          (value) => {
                            ProvinceCheck(value, name.name, index, i);
                          }
                        "
                      ></el-checkbox>
                      <div
                        class="item_text"
                        :class="name.isShow ? 'is_active_name' : ''"
                        @click="ActiveProvince(name.name, index, i)"
                      >
                        {{ name.name }}
                        <div v-if="name.multipleShow" class="bot_bot"></div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </el-tab-pane>
            <el-tab-pane label="市" name="city">
              <div>
                <div
                  class="flex-box l-s-s letter_list"
                  v-for="(item, index) in cityList"
                  :key="'city_' + index"
                >
                  <div class="range flex-box l-c-s">
                    {{ item.value }}
                  </div>
                  <div class="flex-box l-s-s name_list">
                    <div
                      class="item flex-box l-c-s"
                      v-for="(name, i) in item.list"
                      :key="'city_name_' + i"
                    >
                      <el-checkbox
                        v-if="isMultiple"
                        :indeterminate="name.unknown"
                        v-model="name.value"
                        @change="
                          (value) => {
                            CityCheck(value, name.name, index, i);
                          }
                        "
                      ></el-checkbox>
                      <div
                        class="item_text"
                        :class="name.isShow ? 'is_active_name' : ''"
                        @click="ActiveCity(name.name, index, i)"
                      >
                        {{ name.name }}
                        <div v-if="name.multipleShow" class="bot_bot"></div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </el-tab-pane>
            <el-tab-pane label="区/县" name="district">
              <div>
                <div
                  class="flex-box l-s-s letter_list"
                  v-for="(item, index) in districtList"
                  :key="'district_' + index"
                >
                  <div class="range flex-box l-c-s">
                    {{ item.value }}
                  </div>
                  <div class="flex-box l-s-s name_list">
                    <div
                      class="item flex-box l-c-s"
                      v-for="(name, i) in item.list"
                      :key="'district_name_' + i"
                    >
                      <el-checkbox
                        v-if="isMultiple"
                        :indeterminate="name.unknown"
                        v-model="name.value"
                        @change="
                          (value) => {
                            DistrictCheck(value, name.name, index, i);
                          }
                        "
                      ></el-checkbox>
                      <div
                        class="item_text"
                        :class="name.isShow ? 'is_active_name' : ''"
                        @click="ActiveDistrict(name.name, index, i)"
                      >
                        {{ name.name }}
                        <div v-if="name.multipleShow" class="bot_bot"></div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </el-tab-pane>
            <el-tab-pane label="街道" name="street">
              <div>
                <div
                  class="flex-box l-s-s letter_list"
                  v-for="(item, index) in streetList"
                  :key="'street_' + index"
                >
                  <div class="range flex-box l-c-s">
                    {{ item.value }}
                  </div>
                  <div class="flex-box l-s-s name_list">
                    <div
                      class="item flex-box l-c-s"
                      v-for="(name, i) in item.list"
                      :key="'street_name_' + i"
                    >
                      <div
                        class="item_text"
                        :class="name.isShow ? 'is_active_name' : ''"
                        @click="ActiveStreet(name.name, true, index, i)"
                      >
                        {{ name.name }}
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </el-tab-pane>
          </el-tabs>
        </div>
        <div class="close_address flex-box l-c-c">
          <el-button type="primary" @click="HideAddress">确认</el-button>
        </div>
      </template>
    </vxe-modal>
  </div>
</template>
<script>
import { GetAreaCitys, GetAreaCityTree } from "@/api/system/addressbase";
import { AddressDivide } from "@/api/usualApi/index";
export default {
  name: "addressInput",
  props: {
    /**是否启用多选 */
    isMultiple: {
      type: Boolean, //类型
      required: false, //是否必填
      default: false, //默认值
    },
    /**全拼地址文本拼接的符号 */
    notation: {
      type: String, //类型
      required: false, //是否必填
      default: "-", //默认值
    },
  },
  data() {
    return {
      /**级联选择器数据 */
      addressAllData: [],
      /**省市区街道标签选中 */
      addressTab: "province",
      openAddress: false,
      /**标签页选中的数据 */
      tabText: [],
      /**省份数据 */
      provinceList: [],
      /**城市数据 */
      cityList: [],
      /**区数据 */
      districtList: [],
      /**街道数据 */
      streetList: [],
      /**选中的索引 */
      indexAddress: [],
      /**多选显示列表 */
      brushList: [],
      /**简单单选选中的数据 */
      addressJson: {
        /**省 */
        province: "",
        /**市 */
        city: "",
        /**区 */
        district: "",
        /**街道 */
        street: "",
        /**全拼文本 */
        spellingText: "",
        /**数组数据 */
        addressList: [],
        provinceId: "",
        cityId: "",
        districtId: "",
        streetId: "",
      },
      /**级联配置 */
      props: {
        value: "name",
        label: "name",
        expandTrigger: "hover",
      },
    };
  },
  methods: {
    /**备用开关
     * @OpenAddress
     */
    async OpenAddress(json = null) {
      await this.GetAddress();
      if (!json) {
        this.openAddress = true;
      } else {
      }
    },
    HideAddress() {
      this.openAddress = false;
    },
    /**检验地址库是否讯在 */
    async GetAddress() {
      if (!this.$store.state.addr.addrData) {
        // 没有缓存数据
        let { statusCode, data } = await GetAreaCityTree();
        if (!statusCode == 200) return;
        this.$store.commit("addr/SET_ADDR", data);
      } else {
        // 存在缓存数据
      }
      if (this.provinceList.length == 0) {
        // @ts-ignore

        this.addressAllData = this.DisposeAddress(this.$store.state.addr.addrData);
      }
      console.log(this.addressAllData);
    },
    /**确认省份 */
    ActiveProvince(name, index, i) {
      // @ts-ignore
      this.indexAddress[0] = [index, i];
      /**回传改变成数组数据 - 单选 */
      let addressList = [name];
      /**回传数据 - 单选 */
      this.addressJson = {
        /**省 */
        province: name,
        /**市 */
        city: "",
        /**区 */
        district: "",
        /**街道 */
        street: "",
        /**全拼文本 */
        spellingText: addressList.join(this.notation),
        /**数组数据 */
        addressList: addressList,
        provinceId: "",
        cityId: "",
        districtId: "",
        streetId: "",
      };
      /**选中的省份 */
      let province = this.provinceList[index].list[i];
      /**清空区和街道的数据避免冲突 */
      this.districtList = [];
      this.streetList = [];
      /**判断是否为多选 */
      if (this.isMultiple) {
        //单选 - 取消其他省份的选中并直接回传数据
        this.provinceList.forEach((item, index) => {
          item.list.forEach((element) => {
            if (element.name != name) {
              element.multipleShow = false;
            } else {
              element.multipleShow = true;
              /**把选中的清除掉 */
              element.list.some((el) => {
                return el.list.some((value) => {
                  if (value.multipleShow) {
                    value.multipleShow = false;
                    return true;
                  }
                });
              });
              this.cityList = element.list;
            }
          });
        });
      } else {
        //单选 - 取消其他省份的选中并直接回传数据
        this.provinceList.forEach((item, index) => {
          item.list.forEach((element) => {
            if (element.name != name) {
              element.isShow = false;
            } else {
              element.isShow = true;
              this.addressJson.provinceId = element.id;
            }
          });
        });

        this.$emit("GetAddress", this.addressJson);
        /**确认市的内容并跳到下一级 */
        this.cityList = AddressDivide(province.children);
      }

      this.addressTab = "city";
    },
    /**确认市*/
    ActiveCity(name, index, i) {
      this.indexAddress[1] = [index, i];
      /**选中的市 */
      let city = this.cityList[index].list[i];
      /**回传改变成数组数据 - 单选 */
      let addressList = [this.addressJson.province, name];
      /**回传数据 - 单选 */
      this.addressJson = {
        province: this.addressJson.province,
        city: name,
        district: "",
        street: "",
        spellingText: addressList.join(this.notation),
        addressList: addressList,
        provinceId: this.addressJson.provinceId,
        cityId: "",
        districtId: "",
        streetId: "",
      };
      /**清空街道 */
      this.streetList = [];
      /**判断是否为多选 */
      if (this.isMultiple) {
        //多选 - 取消其他市的选中并直接回传数据
        this.cityList.forEach((item, index) => {
          item.list.forEach((element) => {
            if (element.name != name) {
              element.multipleShow = false;
            } else {
              element.multipleShow = true;
              /**把选中的清除掉 */
              element.list.some((el) => {
                return el.list.some((value) => {
                  if (value.multipleShow) {
                    value.multipleShow = false;
                    return true;
                  }
                });
              });
              this.districtList = element.list;
            }
          });
        });
      } else {
        //单选 - 取消其他市的选中并直接回传数据
        this.cityList.forEach((item, index) => {
          item.list.forEach((element) => {
            if (element.name != name) {
              element.isShow = false;
            } else {
              element.isShow = true;
              this.addressJson.cityId = element.id;
            }
          });
        });

        this.$emit("GetAddress", this.addressJson);
        /**确认区的内容并跳到下一级 */
        this.districtList = AddressDivide(city.children);
      }
      this.addressTab = "district";
    },
    /**确认区 */
    ActiveDistrict(name, index, i) {
      this.indexAddress[2] = [index, i];
      /**选中的区 */
      let district = this.districtList[index].list[i];
      /**回传改变成数组数据-单选 */
      let addressList = [this.addressJson.province, this.addressJson.city, name];
      /**回传数据-单选 */
      this.addressJson = {
        province: this.addressJson.province,
        city: this.addressJson.city,
        district: name,
        street: "",
        spellingText: addressList.join(this.notation),
        addressList: addressList,
        provinceId: this.addressJson.provinceId,
        cityId: this.addressJson.cityId,
        districtId: "",
        streetId: "",
      };

      /**判断是否为多选 */
      if (this.isMultiple) {
        //多选 - 取消其他市的选中并直接回传数据
        this.districtList.forEach((item) => {
          item.list.forEach((element) => {
            if (element.name != name) {
              element.multipleShow = false;
            } else {
              element.multipleShow = true;
              /**把选中的清除掉 */
              element.list.some((el) => {
                return el.list.some((value) => {
                  if (value.multipleShow) {
                    value.multipleShow = false;
                    return true;
                  }
                });
              });
              this.streetList = element.list;
            }
          });
        });
      } else {
        //单选 - 取消其他区的选中并直接回传数据
        this.districtList.forEach((item, index) => {
          item.list.forEach((element) => {
            if (element.name != name) {
              element.isShow = false;
            } else {
              element.isShow = true;
              this.addressJson.districtId = element.id;
            }
          });
        });

        this.$emit("GetAddress", this.addressJson);
        /**确认街道的内容并跳到下一级 */
        this.streetList = AddressDivide(district.children);
      }
      this.addressTab = "street";
    },
    /**确认街道 */
    ActiveStreet(name, isClose = true, index, i) {
      this.indexAddress[3] = [index, i];
      /**回传改变成数组数据 - 单选 */
      let addressList = [
        this.addressJson.province,
        this.addressJson.city,
        this.addressJson.district,
        name,
      ];
      /**回传数据-单选 */
      this.addressJson = {
        province: this.addressJson.province,
        city: this.addressJson.city,
        district: this.addressJson.district,
        street: name,
        spellingText: addressList.join(this.notation),
        addressList: addressList,
        provinceId: this.addressJson.provinceId,
        cityId: this.addressJson.cityId,
        districtId: this.addressJson.districtId,
        streetId: "",
      };

      /**判断是否为多选 */
      if (this.isMultiple) {
        //多选选 - 取消其他街道的选中并直接回传数据,关闭页面
        this.streetList.forEach((item, index) => {
          item.list.forEach((element) => {
            if (element.name == name) {
              element.isShow = !element.isShow;
              //向上检测选中状态
              this.SuperiorSelected(element.isShow, 3);
            }
          });
        });
      } else {
        //单选 - 取消其他街道的选中并直接回传数据,关闭页面
        this.streetList.forEach((item, index) => {
          item.list.forEach((element) => {
            if (element.name != name) {
              element.isShow = false;
            } else {
              element.isShow = true;
              this.addressJson.streetId = element.id;
            }
          });
        });
        console.log(this.addressJson);

        this.$emit("GetAddress", this.addressJson);
        // if (!this.isMultiple) {
        //   this.openAddress = false;
        // }
      }
    },
    /*处理地址数据，方便级联选择 且处理点选多选页面逻辑 */
    DisposeAddress(list) {
      const DisposeList = (row) => {
        row.forEach((item) => {
          if (item.children == null || item.children.length == 0) {
            item.leaf = true;
            item.children = null;
          } else {
            DisposeList(item.children);
          }
        });
      };
      list.forEach((el) => {
        DisposeList(el.children);
      });
      let allList = AddressDivide(this.$store.state.addr.addrData);
      if (this.isMultiple) {
        const DisposeMultiple = (data) => {
          data.forEach((value) => {
            value.list.forEach((el) => {
              if (el.children != null && el.children.length != 0) {
                el.list = AddressDivide(el.children);
                DisposeMultiple(el.list);
              }
            });
          });
        };
        DisposeMultiple(allList);
        this.provinceList = allList;
      } else {
        this.provinceList = allList;
      }
      console.log(allList);

      return list;
    },
    /**搜索地址更改 */
    ChangeSearchAddress(row) {
      if (row.length != 0) {
        if (row[0] == "") return;
        let provinceIndex = 0;
        let provinceNum = 0;
        /**识别省份 */
        this.provinceList.some((item, index) => {
          // @ts-ignore
          return item.list.some((el, i) => {
            if (el.name == row[0]) {
              provinceIndex = index;
              provinceNum = i;
              return true;
            }
          });
        });
        this.ActiveProvince(row[0], provinceIndex, provinceNum);

        if (row[1] == "") return;
        let cityIndex = 0;
        let cityNum = 0;
        /**识别城市 */
        this.cityList.some((item, index) => {
          // @ts-ignore
          return item.list.some((el, i) => {
            if (el.name == row[1]) {
              cityIndex = index;
              cityNum = i;
              return true;
            }
          });
        });
        this.ActiveCity(row[1], cityIndex, cityNum);
        if (row[2] == "") return;
        let districtIndex = 0;
        let districtNum = 0;
        /**识别区 */
        this.districtList.some((item, index) => {
          // @ts-ignore
          return item.list.some((el, i) => {
            if (el.name == row[2]) {
              districtIndex = index;
              districtNum = i;
              return true;
            }
          });
        });
        this.ActiveDistrict(row[2], districtIndex, districtNum);
        if (row[3] == "") return;
        this.ActiveStreet(row[3], false);
      }
    },
    /**省份被选中了 */
    ProvinceCheck(checkValue, name, provinceIndex, provinceNum) {
      /**全部选中 */
      let allAddress = this.provinceList;
      //选中的省
      let province = allAddress[provinceIndex].list[provinceNum];
      /**先将自己的颜色点亮 */
      province.isShow = checkValue;
      province.unknown = false;

      let list = this.SelectedCheck(province.list, checkValue);
      province.list = list;
      this.DisposeMultiple();
    },
    /**市被全选或全不选 */
    CityCheck(checkValue, name, cityIndex, cityNum) {
      /**全部选中 */
      let allAddress = this.provinceList;
      //选中的省
      let city =
        allAddress[this.indexAddress[0][0]].list[this.indexAddress[0][1]].list[cityIndex]
          .list[cityNum];

      // /**先将自己的颜色点亮 */
      city.isShow = checkValue;
      city.unknown = false;
      let list = this.SelectedCheck(city.list, checkValue);
      city.list = list;
      this.SuperiorSelected(checkValue, 1);
    },
    /**区被选中或取消 */
    DistrictCheck(checkValue, name, districtIndex, districtNum) {
      /**全部选中 */
      let allAddress = this.provinceList;
      //选中的省
      let district =
        allAddress[this.indexAddress[0][0]].list[this.indexAddress[0][1]].list[
          this.indexAddress[1][0]
        ].list[this.indexAddress[1][1]].list[districtIndex].list[districtNum];
      // /**先将自己的颜色点亮 */
      district.isShow = checkValue;
      district.unknown = false;
      let list = this.SelectedCheck(district.list, checkValue);
      district.list = list;
      this.SuperiorSelected(checkValue, 2);
    },
    /**选中并递归 */
    SelectedCheck(list, value) {
      let data = list;
      data.forEach((item) => {
        item.list.forEach((el) => {
          el.isShow = value;
          el.value = value;
          el.unknown = false;
          if (el.list != undefined && el.list.length != 0) {
            this.SelectedCheck(el.list, value);
          }
        });
      });
      return data;
    },
    /**向上检测是否选中 */
    async SuperiorSelected(isTrue, i) {
      /**存的所有区域选中数据 */
      let indexAll = this.indexAddress;
      /**检测城市 */
      const cityDetect = async () => {
        /**获取区数据 */
        let list = this.provinceList;

        /**确认是否全选 */
        let isAll = list[indexAll[0][0]].list[indexAll[0][1]].list.some((item) => {
          return item.list.some((el) => {
            if (isTrue != el.value || el.unknown) {
              return true;
            }
          });
        });
        if (!isAll) {
          list[indexAll[0][0]].list[indexAll[0][1]].value = isTrue;
          list[indexAll[0][0]].list[indexAll[0][1]].unknown = false;
          list[indexAll[0][0]].list[indexAll[0][1]].isShow = isTrue;
        } else {
          list[indexAll[0][0]].list[indexAll[0][1]].value = false;
          list[indexAll[0][0]].list[indexAll[0][1]].unknown = true;
          list[indexAll[0][0]].list[indexAll[0][1]].isShow = false;
        }
        this.provinceList = list;
      };
      /**检测区 */
      const districtDetect = async () => {
        /**获取区数据 */
        let list = this.provinceList[indexAll[0][0]].list[indexAll[0][1]].list;
        /**确认是否全选 */
        let isAll = list[indexAll[1][0]].list[indexAll[1][1]].list.some((item) => {
          return item.list.some((el) => {
            if (isTrue != el.value || el.unknown) {
              console.log(isTrue, el.value, el.unknown, el);
              setTimeout(() => {
                console.log(el.unknown);
              }, 5000);
              return true;
            }
          });
        });
        if (!isAll) {
          if (
            list[indexAll[1][0]].list[indexAll[1][1]].value != isTrue ||
            list[indexAll[1][0]].list[indexAll[1][1]].unknown
          ) {
            list[indexAll[1][0]].list[indexAll[1][1]].value = isTrue;
            list[indexAll[1][0]].list[indexAll[1][1]].isShow = isTrue;
            list[indexAll[1][0]].list[indexAll[1][1]].unknown = false;
            await cityDetect();
          } else {
            list[indexAll[1][0]].list[indexAll[1][1]].isShow = isTrue;
            list[indexAll[1][0]].list[indexAll[1][1]].unknown = false;
          }
        } else {
          list[indexAll[1][0]].list[indexAll[1][1]].value = false;
          list[indexAll[1][0]].list[indexAll[1][1]].isShow = false;
          if (list[indexAll[1][0]].list[indexAll[1][1]].unknown == false) {
            list[indexAll[1][0]].list[indexAll[1][1]].unknown = true;
            await cityDetect();
          }
        }
        this.cityList = list;
      };
      /**检测街道 */
      const streetDetect = async () => {
        /**获取街道数据 */
        let list = this.provinceList[indexAll[0][0]].list[indexAll[0][1]].list[
          indexAll[1][0]
        ].list[indexAll[1][1]].list;
        /**确认是否全选 */
        let isAll = list[indexAll[2][0]].list[indexAll[2][1]].list.some((item) => {
          return item.list.some((el) => {
            if (isTrue != el.isShow) {
              return true;
            }
          });
        });
        if (!isAll) {
          if (
            list[indexAll[2][0]].list[indexAll[2][1]].value != isTrue ||
            list[indexAll[2][0]].list[indexAll[2][1]].unknown
          ) {
            list[indexAll[2][0]].list[indexAll[2][1]].value = isTrue;
            list[indexAll[2][0]].list[indexAll[2][1]].isShow = isTrue;
            list[indexAll[2][0]].list[indexAll[2][1]].unknown = false;
            await districtDetect();
          } else {
            list[indexAll[2][0]].list[indexAll[2][1]].isShow = isTrue;
            list[indexAll[2][0]].list[indexAll[2][1]].unknown = false;
          }
        } else {
          list[indexAll[2][0]].list[indexAll[2][1]].isShow = false;
          list[indexAll[2][0]].list[indexAll[2][1]].value = false;
          if (list[indexAll[2][0]].list[indexAll[2][1]].unknown == false) {
            list[indexAll[2][0]].list[indexAll[2][1]].unknown = true;
            await districtDetect();
          }
        }
        this.districtList = list;
      };
      if (i == 3) {
        await streetDetect();
      } else if (i == 2) {
        await districtDetect();
      } else if (i == 1) {
        await cityDetect();
      }
      this.DisposeMultiple();
    },
    /**获取多选数据并处理数据 */
    DisposeMultiple() {
      let brushList = [];
      let addressListMore = this.provinceList;
      addressListMore.forEach((allList) => {
        allList.list.forEach((provinceItem) => {
          if (provinceItem.unknown) {
            //遍历市区
            provinceItem.list.forEach((cityList) => {
              cityList.list.forEach((cityItem) => {
                if (cityItem.unknown) {
                  //遍历区县
                  cityItem.list.forEach((districtList) => {
                    districtList.list.forEach((districtItem) => {
                      if (districtItem.unknown) {
                        //遍历街道
                        districtItem.list.forEach((streetList) => {
                          streetList.list.forEach((streetItem) => {
                            if (streetItem.isShow) {
                              //选中街道
                              brushList.push({
                                province: provinceItem.name,
                                city: cityItem.name,
                                district: districtItem.name,
                                street: streetItem.name,
                                provinceId: provinceItem.id,
                                cityId: cityItem.id,
                                districtId: districtItem.id,
                                streetId: streetItem.id,
                                showText:
                                  provinceItem.name +
                                  this.notation +
                                  cityItem.name +
                                  this.notation +
                                  districtItem.name +
                                  this.notation +
                                  streetItem.name,
                              });
                            }
                          });
                        });
                      } else if (districtItem.value) {
                        /**区县全选 */
                        brushList.push({
                          province: provinceItem.name,
                          city: cityItem.name,
                          district: districtItem.name,
                          street: "",
                          provinceId: provinceItem.id,
                          cityId: cityItem.id,
                          districtId: districtItem.id,
                          streetId: "",
                          showText:
                            provinceItem.name +
                            this.notation +
                            cityItem.name +
                            this.notation +
                            districtItem.name,
                        });
                      }
                    });
                  });
                } else if (cityItem.value) {
                  // 当市区全选的时候
                  brushList.push({
                    province: provinceItem.name,
                    city: cityItem.name,
                    district: "",
                    street: "",
                    provinceId: provinceItem.id,
                    cityId: cityItem.id,
                    districtId: "",
                    streetId: "",
                    showText: provinceItem.name + this.notation + cityItem.name,
                  });
                }
              });
            });
          } else if (provinceItem.value) {
            //当省份全选的时候
            brushList.push({
              province: provinceItem.name,
              city: "",
              district: "",
              street: "",
              provinceId: provinceItem.id,
              cityId: "",
              districtId: "",
              streetId: "",
              showText: provinceItem.name,
            });
          }
        });
      });
      this.brushList = brushList;
    },
  },
  created() {
    this.GetAddress();
  },
};
</script>
<style lang="scss" src="./index.scss"></style>
